Xbasic

FILENAME_FROM_ALIAS Function

Syntax

Fully_Qualified_Filename as C = filename_from_alias(C filename )

Arguments

filename

An alias and filename (typically without path information).

Description

Converts an aliased filename to a real filename

Discussion

FILENAME_FROM_ALIAS() returns a character string after converting an aliased filename to a fully qualified filename. The value of the FILENAME_FROM_ALIAS() and FILENAME_TO_ALIAS()functions is that they make it easier to develop an application that is less location dependent. You can define file aliases on the "Alias" tab in the View Settings dialog. For example, the alias [image_folder] can refer to c:\images\ on one user's machine, and d:\data\images on another machine. Aliases are particularly useful if you use the new field type "Image File Reference" which stores an image filename in the field rather than the field itself. When you transport the database and the folder which contains the images to another machine that has different drive mappings, all that you have to do on the new machine is ensure that an appropriate entry exists in the alias table. (The aliases are actually stored in the a_aliases.aliases text file in the Alpha Anywhere program folder). The alias reference can be an explicit drive/path, or it can be an expression that evaluates to a drive/path. For example, the alias [exepath] could be set to " = a5.get_exe_path()". To specify an expression, prefix the expression with " = ". In the following example, [documents] is defined as c:\documents\.

Example

dim cs as C
cs = filename_from_alias("[documents]upgrade.txt")
cs -> "c:\Documents\upgrade.txt"

See Also